.class public Lcom/zuiapps/suite/utils/device/MobileDataUtil;
.super Ljava/lang/Object;
.source "MobileDataUtil.java"


# instance fields
.field private mConnectivityManager:Landroid/net/ConnectivityManager;

.field private mContext:Landroid/content/Context;

.field private mHandler:Landroid/os/Handler;

.field private mIsSupportMobileData:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 23
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 20
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mHandler:Landroid/os/Handler;

    .line 24
    iput-object p1, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mContext:Landroid/content/Context;

    .line 25
    const-string v0, "connectivity"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    iput-object v0, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mConnectivityManager:Landroid/net/ConnectivityManager;

    .line 26
    return-void
.end method


# virtual methods
.method public isExistSim()Z
    .registers 5

    .prologue
    const/4 v1, 0x1

    .line 47
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mContext:Landroid/content/Context;

    const-string v3, "phone"

    invoke-virtual {v2, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/telephony/TelephonyManager;

    .line 48
    .local v0, "localTelephonyManager":Landroid/telephony/TelephonyManager;
    if-eqz v0, :cond_1a

    invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->getSimState()I

    move-result v2

    if-eq v2, v1, :cond_1a

    invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->getSimState()I

    move-result v2

    if-eqz v2, :cond_1a

    :goto_19
    return v1

    :cond_1a
    const/4 v1, 0x0

    goto :goto_19
.end method

.method public isMobileDataOpened()Z
    .registers 10

    .prologue
    .line 30
    const-string v7, "getMobileDataEnabled"

    .line 31
    .local v7, "methodName":Ljava/lang/String;
    iget-object v8, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mConnectivityManager:Landroid/net/ConnectivityManager;

    invoke-virtual {v8}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v3

    .line 32
    .local v3, "cmClass":Ljava/lang/Class;
    const/4 v5, 0x0

    .line 33
    .local v5, "isOpen":Ljava/lang/Boolean;
    const/4 v1, 0x0

    .line 34
    .local v1, "argClasses":[Ljava/lang/Class;
    const/4 v2, 0x0

    .line 36
    .local v2, "argObject":[Ljava/lang/Object;
    :try_start_b
    invoke-virtual {v3, v7, v1}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v6

    .line 38
    .local v6, "method":Ljava/lang/reflect/Method;
    iget-object v8, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mConnectivityManager:Landroid/net/ConnectivityManager;

    invoke-virtual {v6, v8, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v8

    move-object v0, v8

    check-cast v0, Ljava/lang/Boolean;

    move-object v5, v0
    :try_end_19
    .catch Ljava/lang/Exception; {:try_start_b .. :try_end_19} :catch_1e

    .line 42
    .end local v6    # "method":Ljava/lang/reflect/Method;
    :goto_19
    invoke-virtual {v5}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v8

    return v8

    .line 39
    :catch_1e
    move-exception v4

    .line 40
    .local v4, "e":Ljava/lang/Exception;
    invoke-virtual {v4}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_19
.end method

.method public setMobileDataForLollipop()Landroid/content/Intent;
    .registers 5

    .prologue
    .line 52
    new-instance v1, Landroid/content/Intent;

    invoke-direct {v1}, Landroid/content/Intent;-><init>()V

    .line 53
    .local v1, "intent":Landroid/content/Intent;
    new-instance v0, Landroid/content/ComponentName;

    const-string v2, "com.android.settings"

    const-string v3, "com.android.settings.Settings$DataUsageSummaryActivity"

    invoke-direct {v0, v2, v3}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 54
    .local v0, "cn":Landroid/content/ComponentName;
    invoke-virtual {v1, v0}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    .line 55
    const/high16 v2, 0x10000000

    invoke-virtual {v1, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 56
    return-object v1
.end method

.method public setMobileDataStatus(Z)Z
    .registers 10
    .param p1, "enabled"    # Z

    .prologue
    const/4 v5, 0x0

    const/4 v4, 0x1

    .line 70
    const/4 v6, 0x1

    :try_start_3
    new-array v0, v6, [Ljava/lang/Class;

    .line 71
    .local v0, "arrayOfClass":[Ljava/lang/Class;
    const/4 v6, 0x0

    sget-object v7, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;

    aput-object v7, v0, v6

    .line 72
    const-class v6, Landroid/net/ConnectivityManager;

    const-string v7, "setMobileDataEnabled"

    invoke-virtual {v6, v7, v0}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v3

    .line 73
    .local v3, "localMethod":Ljava/lang/reflect/Method;
    const/4 v6, 0x1

    invoke-virtual {v3, v6}, Ljava/lang/reflect/Method;->setAccessible(Z)V

    .line 74
    const/4 v6, 0x1

    new-array v1, v6, [Ljava/lang/Object;

    .line 75
    .local v1, "arrayOfObject":[Ljava/lang/Object;
    const/4 v6, 0x0

    invoke-static {p1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v7

    aput-object v7, v1, v6

    .line 76
    iget-object v6, p0, Lcom/zuiapps/suite/utils/device/MobileDataUtil;->mConnectivityManager:Landroid/net/ConnectivityManager;

    invoke-virtual {v3, v6, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_25
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_25} :catch_26

    .line 81
    .end local v0    # "arrayOfClass":[Ljava/lang/Class;
    .end local v1    # "arrayOfObject":[Ljava/lang/Object;
    .end local v3    # "localMethod":Ljava/lang/reflect/Method;
    :goto_25
    return v4

    .line 78
    :catch_26
    move-exception v2

    .line 79
    .local v2, "e":Ljava/lang/Exception;
    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    move v4, v5

    .line 81
    goto :goto_25
.end method

.method public setMobileDataViaIntent()Landroid/content/Intent;
    .registers 5

    .prologue
    .line 60
    new-instance v1, Landroid/content/Intent;

    invoke-direct {v1}, Landroid/content/Intent;-><init>()V

    .line 61
    .local v1, "intent":Landroid/content/Intent;
    new-instance v0, Landroid/content/ComponentName;

    const-string v2, "com.android.settings"

    const-string v3, "com.android.settings.Settings$DataUsageSummaryActivity"

    invoke-direct {v0, v2, v3}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 62
    .local v0, "cn":Landroid/content/ComponentName;
    invoke-virtual {v1, v0}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    .line 63
    const/high16 v2, 0x10000000

    invoke-virtual {v1, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 64
    return-object v1
.end method
